<?php
	/**
	 * [Time]
	 * @Author   :zy
	 * @DateTime :2016-08-16T18:34:54+0800
	 * @Detail   :This Class Is The Example
	 */
	namespace Home\Util;
	
	class SendMsgApplyUtil {

    static public function SetData($data,$type){
        $url = $data['url'];
		$openid = $data['openid'];
		$applyid = $data['applyid'];
		$state = $data['state'];
		$template_id = 'UoZy9X_VbMaLJJ_Oag3jZTSu4msnZ-gU8Q1M8_r-4ws';
        if($type==0){
            $txt="司机";
        }else if($type==1){
            $txt="客服";
        }
        if($state==1){
            $state='通过';
            $detail='恭喜您已经成为车旅['.$txt.']！【点击这里】完成你的角色更新！';
        }else{
            $state='不通过';
            $detail='原因：'.$data['reason'];
        }
		$template = array(
            'touser' => $openid,
            'template_id' => $template_id,
            'url' =>$url,
            'data' => array(
                'first' => array(
                    'value' => '您好，您申请成为'.$txt.'的审核结果如下。',
                    'color' => "#173177"
                ),
                'keyword1' => array(
                    'value' => $applyid,
                    'color' => "#173177"
                ),
                'keyword2' => array(
                    'value' => "\n审核结果：".$state,
                    'color' => "#173177"
                ),
                'remark' => array(
                    'value' => $detail,
                    'color' => "#173177"
                )
            )
        );
		$SendMsg =  new \Util\WechatSendMsg('wxa61d5ad1056c9b66','3b3e14ecb756e155b82226dde95a138e');
		$SendMsg ->SendTplMsg(json_encode($template));
    }
}
	?>